import { Drawer } from "antd"
import React from "react"

interface TaskLogDrawerProps {
  visible: boolean
  onClose: () => void
  logs: string[]
}

const TaskLogDrawer: React.FC<TaskLogDrawerProps> = ({
  visible,
  onClose,
  logs,
}) => (
  <Drawer
    open={visible}
    title="任务日志"
    placement="right"
    width={480}
    onClose={onClose}
    destroyOnClose
  >
    <div className="task-log-drawer-content">
      {logs && logs.length > 0 ? (
        logs.map((log, idx) => (
          <div key={idx} className="task-log-drawer-item">
            {log}
          </div>
        ))
      ) : (
        <div className="task-log-drawer-empty">暂无日志</div>
      )}
    </div>
  </Drawer>
)

export default TaskLogDrawer
